package com.ojoin.ojoin.eb_spider.service;

import java.io.IOException;

import org.springframework.stereotype.Service;

import com.ojoin.ojoin.eb_spider.domain.AssistCatchData;
import com.ojoin.ojoin.eb_spider.domain.BankCardCheck;
import com.ojoin.trade.common.exception.BusinessException;

/**
 * 供应链贷 数据抓取基类 服务接口
 * 
 * @author
 * 
 */
@Service
public interface ISLDataCatchBaseService{
	boolean isLoginSuccess() throws Exception;

	boolean prepareCatchData() throws BusinessException, Exception;

	boolean LoginByUserInfo(String baseUrl, String username, String password) throws Exception;

	// 抓取数据 供应商账号检查结果(0不一致1一致)
	final int CATCHDATA__ERROR = 0;
	final int CATCHDATA__CORRECT = 1;

	boolean init(AssistCatchData assistCatchData);

	/**
	 * 是否缓存session在线
	 * 
	 * @return
	 * @throws BusinessException
	 * @throws Exception 
	 */
	boolean isCacheLogin() throws BusinessException, Exception;

	void saveCookies() throws IOException;



	/**
	 * 抓取供应商名称
	 * 
	 * @return
	 */
	String catchSupplierName() throws BusinessException;

	BankCardCheck isSupplyAccountCorrect() throws BusinessException;

	/**
	 * 抓取供应商结算账号
	 * 
	 * @return
	 */
	BankCardCheck catchSupplierAccount() throws BusinessException;

	boolean isSupplyInfoCorrect() throws BusinessException;

	boolean isTaskRunSuccess() throws BusinessException, Exception;

	/**
	 * 抓取数据
	 * 
	 * @param
	 * @param
	 * @throws BusinessException
	 * @throws Exception
	 */
	void catchData(AssistCatchData assistCatchData)
			throws BusinessException, Exception;

	/**
	 * 关闭抓取数据
	 * 
	 * @return
	 * @throws BusinessException
	 */
	void closeCatchData(boolean isuser) throws BusinessException;

	/**
	 * 关闭抓取数据
	 * 
	 * @return
	 * @throws BusinessException
	 */
	void closeCatchData(boolean islogin, boolean isuser)
			throws BusinessException;

	/**
	 * 获取电商业务单据数据
	 * 
	 * @return
	 * @throws BusinessException
	 * @throws Exception
	 */
	void getBusinessData() throws BusinessException, Exception;

	/**
	 * 获取未付款结算单数据
	 * 
	 * @return
	 * @throws BusinessException
	 * @throws Exception 
	 */
	boolean getUnpayAccountData() throws BusinessException, IOException, Exception;

	/**
	 * 获取已付款结算单数据
	 * 
	 * @return
	 * @throws BusinessException
	 * @throws Exception
	 */
	boolean getPayAccountData() throws BusinessException, Exception;

	/**
	 * 获取出库单数据
	 * 
	 * @return
	 * @throws Exception 
	 * @throws BusinessException
	 */
	boolean getOutstoreOrderData() throws IOException, Exception;

	/**
	 * 获取出库单数据
	 * 
	 * @return
	 * @throws Exception 
	 * @throws BusinessException
	 */
	boolean getInstoreOrderData() throws IOException, Exception;

}
